<form id="pagerForm" method="post" action="">
	<input type="hidden" name="pageNum" value="{$pageNum}" />
	<input type="hidden" name="numPerPage" value="{$numPerPage}" />
	<input type="hidden" name="orderField" value="{$orderField}" />
	<input type="hidden" name="orderDirection" value="{$orderDirection}" />
	<input type="hidden" name="keywords" value="{$keywords}" />
	<input type="hidden" name="sfield" value="{$sfield}" />
	<input type="hidden" name="platform" value="{$platform}" />
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="" method="post">
		<input type="hidden" name="m" value="{$module_name}" />
		<input type="hidden" name="a" value="{$action_name}" />
	<div class="searchBar">
		<ul class="searchContent">
			<li style="width:170px;">
				<label style="width:50px;">关键字：</label>
				<input type="text" name="keywords" value="{$keywords}" style="width:80px;"/>
			</li>
			<li style="width:100px;">
			<select name="sfield" class="combox">
				<option value="all" {if $sfied=='all'}selected="selected"{/if}>全部</option>
				<option value="id" {if $sfied=='id'}selected="selected"{/if}>ID</option>
				<option value="user_id" {if $sfied=='user_id'}selected="selected"{/if}>分销商ID</option>
				<option value="realname" {if $sfied=='realname'}selected="selected"{/if}>联系人</option>
				<option value="company" {if $sfied=='company'}selected="selected"{/if}>商家名称</option>
				<option value="contract_sn" {if $sfied=='contract_sn'}selected="selected"{/if}>合同编号</option>
				<option value="mobile" {if $sfied=='mobile'}selected="selected"{/if}>手机号码</option>
				<option value="tel" {if $sfied=='tel'}selected="selected"{/if}>电话号码</option>

			</select>
			<input type="hidden" name="sfield_name" value="id,user_id,mobile,tel,realname,company" />
			</li>
			<li style="width:150px;">
                <label style="width:60px;">商户类型：</label>
                <select name="stype" class="combox"> 
                    <option value="all" {if $stype=='all'||empty($stype)}selected="selected"{/if}>全部</option>
                    <option value="1" {if $stype=='1'}selected="selected"{/if}>省专营商</option>
                    <option value="2" {if $stype=='2'}selected="selected"{/if}>市专营商</option>
                    <option value="3" {if $stype=='3'}selected="selected"{/if}>区专营商</option>
                    <option value="4" {if $stype=='4'}selected="selected"{/if}>代理商</option>
                </select>
            </li>
            <li style="width:380px;">
                <label style="width:60px;">商户区域：</label>
                <select name="vesting_province"   ref="city_agent" refUrl="{:U('Agent/area')}&id={value}&level=2" class="combox">
                    <option value="all">请选择省份...</option>
                    <volist name="Area_list" id="vo">
                        {if $vo['parentid'] == 0}
                        <option value="{$vo['id']}" {if $vesting_province==$vo['id']}selected="selected"{/if}>{$vo['name']}</option>
                        {/if}
                    </volist>
                  </select>
                  <select name="vesting_city" ref="area_agent" refUrl="{:U('Agent/area')}&id={value}&level=3" id="city_agent" class="combox">
                    <option value="all">请选择城市...</option>
                    {if !empty($vesting_city)}
                    <volist name="Area_list" id="vo">
                        {if $vo['parentid'] == $vesting_province}
                        <option value="{$vo['id']}" {if $vesting_city==$vo['id']}selected="selected"{/if}>{$vo['name']}</option>
                        {/if}
                    </volist>
                    {/if}
                  </select>
                  <select name="vesting_area" id="area_agent" class="combox">
                    <option value="all">请选择区域...</option>
                    {if !empty($vesting_area)}
                    <volist name="Area_list" id="vo">
                        {if $vo['parentid'] == $vesting_city}
                        <option value="{$vo['id']}" {if $vesting_area==$vo['id']}selected="selected"{/if}>{$vo['name']}</option>
                        {/if}
                    </volist>
                    {/if}
                  </select>
            </li>
            <li style="width:310px;">
                <label style="width:60px;">商户状态：</label>
                <select name="pay_status" class="combox">
                    <option value="all" {if $pay_status=='all'||empty($pay_status)}selected="selected"{/if}>请选择...</option>
                    <option value="-1" {if $pay_status=='-1'}selected="selected"{/if}>未付款</option>
                    <option value="1" {if $pay_status=='1'}selected="selected"{/if}>线上付款失败</option>
                    <option value="2" {if $pay_status=='2'}selected="selected"{/if}>线下付款失败</option>
                    <option value="3" {if $pay_status=='3'}selected="selected"{/if}>付款中</option>
                    <option value="4" {if $pay_status=='4'}selected="selected"{/if}>线上已付款</option>
                    <option value="5" {if $pay_status=='5'}selected="selected"{/if}>线下已付款</option>
                </select>
                <select name="status" class="combox">
                    <option value="all" {if $status=='all'||empty($status)}selected="selected"{/if}>请选择...</option>
                    <option value="-1" {if $status=='-1'}selected="selected"{/if}>未审核</option>
                    <option value="1" {if $status=='1'}selected="selected"{/if}>审核未通过</option>
                    <option value="2" {if $status=='2'}selected="selected"{/if}>审核通过</option>
                </select>
                <select name="isclose" class="combox">
                    <option value="all" {if $isclose=='all'||empty($isclose)}selected="selected"{/if}>请选择...</option>
                    <option value="-1" {if $isclose=='-1'}selected="selected"{/if}>未开通</option>
                    <option value="1" {if $isclose=='1'}selected="selected"{/if}>关闭帐户</option>
                    <option value="2" {if $isclose=='2'}selected="selected"{/if}>开通帐户</option>
                </select>
            </li>
			<div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div>
		</ul>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<!--<php>
				$param=array();
				if($pid){
				}
			</php>-->
			<!--<li><a class="add" href="{:U('User/add',$param)}" target="dialog" width="580" height="350" rel="User_add"><span>添加用户</span></a></li>-->
			<li><a class="edit" href="{:U('Agent/edit')}&id={sid_dv}" target="dialog" width="600" height="350" warn="请选择一条信息"><span>修改信息</span></a></li>
			<li><a class="icon" width="830" height="380" href="{:U('Agent/detail')}&id={sid_dv}" target="dialog" warn="请选择一条信息"><span>查看信息</span></a></li>
			<li><a class="icon" href="{:U('Agent/relation_all')}" target="ajaxTodo"><span>一键关联</span></a></li>
			<!--<li><a class="icon" href="javascript:$.printBox('user_list')"><span>打印</span></a></li>-->
		</ul>
	</div>
	<div id="user_list">
	<table class="table" layoutH="110">
		<thead>
			<tr>
				<th width="30"><input type="checkbox" group="ids[]" class="checkboxCtrl"></th>
				<th width="40" orderField="id" {if $orderField=='id'}class="{$orderDirection}"{/if}>ID</th>
				<th width="80" orderField="user_id" {if $orderField=='user_id'}class="{$orderDirection}"{/if}>分销商ID(账户名)</th>
				<th width="50" orderField="stype" {if $orderField=='stype'}class="{$orderDirection}"{/if}>类型</th>
				<th width="130" orderField="realname" {if $orderField=='realname'}class="{$orderDirection}"{/if}>商家名称(联系人)</th>	
				<th width="160" orderField="vesting_province" {if $orderField=='vesting_province'}class="{$orderDirection}"{/if}>专营区域</th>										
				<th width="190" orderField="mobile" {if $orderField=='mobile'}class="{$orderDirection}"{/if}>电话/手机</th>
				<th width="160" orderField="starttime" {if $orderField=='starttime'}class="{$orderDirection}"{/if}>合约开始</th>
				<th width="160" orderField="endtime" {if $orderField=='endtime'}class="{$orderDirection}"{/if}>合约结束</th>
				<th width="245">状态</th>
				<th width="450">编辑</th>
			</tr>
		</thead>
		<tbody>
<volist name="list" id="vo">
			<tr target="sid_dv" rel="{$vo['id']}">
				<td><input name="ids[]" value="{$vo['id']}" type="checkbox"></td>
				<td>{$vo['id']}</td>
				<td><a title="查看" style="color:blue;" target="dialog" width="830" height="380" href="{:U('User/detail',array('id'=>$vo['user_id']))}">{$vo['user_id']}({$vo['username']})</a></td>
				<td>{$agent_stype[$vo['stype']]}</td>
				<td>{if empty($vo[company])}{$vo[realname]}{else}{$vo[company]}({$vo[realname]}){/if}</td>
				<td><a title="{$Area[$vo[province]]['name']}/{$Area[$vo[city]]['name']}/{$Area[$vo[area]]['name']}/{$vo[address]}">{$Area[$vo[vesting_province]]['name']}{if $vo[vesting_city]!=0}|{$Area[$vo[vesting_city]]['name']}{/if}{if $vo[vesting_area]!=0}|{$Area[$vo[vesting_area]]['name']}{/if}</a></td>
				<td>{if empty($vo[tel])}{$vo[mobile]}{else}{$vo[tel]}({$vo[mobile]}){/if}</td>
				<td>{$vo[starttime] ? $vo[starttime]|date='Y-m-d H:m:s',###:''}</td>
				<td>{$vo[endtime] ? $vo[endtime]|date='Y-m-d H:m:s',###:''}</td>
				<td>{$agent_pay_status[$vo[pay_status]]}|{$agent_status[$vo[status]]}|{$agent_isclose[$vo[isclose]]}</td>
				<td>
				<a title="编辑" target="dialog" width="600" height="350"  rel="Agent_edit_{$vo['id']}" href="{:U('Agent/edit',array('id'=>$vo['id']))}" class="btnEdit">编辑</a>
				{if $vo[status] == 2}
				<!--<a  title="区域会员" target="navTab" rel="Areauser" href="{:U('Areauser/index',array('sfield'=>'agent_id','keywords'=>$vo['user_id']))}" class="btnhy ">会员</a>-->
				<a  title="区域会员订单" target="navTab" rel="Areauser" href="{:U('Areauser/order',array('stype'=>'agent_id','keywords'=>$vo['user_id']))}" class="btndd">订单</a>
				<a  title="区域会员资产" target="navTab" rel="Areauser" href="{:U('Areauser/money',array('stype'=>'agent_id','keywords'=>$vo['user_id']))}" class=" btnzc">资产</a>
				<a title="专营商{$vo['user_id']}的结算" target="dialog" width="400" height="165" rel="Agent_edit_{$vo['id']}" href="{:U('Agent/jiesuan',array('id'=>$vo['user_id']))}">结算</a>
				<a title="关联" target="ajaxTodo" href="{:U('Agent/relation',array('userid'=>$vo['user_id'],'province'=>$vo['vesting_province'],'city'=>$vo['vesting_city'],'area'=>$vo['vesting_area'],'stype'=>$vo['stype']))}">关联</a>
				<a title="设置附属区域" target="dialog" width="600" height="350"  rel="Agent_atttched_{$vo['id']}" href="{:U('Agent/attached',array('id'=>$vo['user_id'],'province'=>$vo['vesting_province'],'city'=>$vo['vesting_city'],'area'=>$vo['vesting_area']))}">附属</a>
				<a title="会员" target="navTab"  rel="Agent_member_{$vo['id']}" href="{:U('Agent/member',array('id'=>$vo['user_id']))}">会员</a>
				<a title="设置结算比例" target="dialog" width="600" height="350"  rel="Agent_profit_{$vo['id']}" href="{:U('Agent/profit',array('id'=>$vo['user_id']))}">比例</a>
				<a title="去专营商分销平台" target="_blank" href="http://agent.smw01.com/index.php?g=home&m=login&a=index&auth={$vo['user_id']},weiming">分销</a>
				{if $vo['user_id'] != 11871}
				<a title="更新专营商利润明细" target="ajaxTodo" href="{:U('Areauser/update_real_pay',array('agent_id'=>$vo['user_id']))}">利润</a>
				{/if}
				{/if}
				</td>
			</tr>
</volist>
		</tbody>
	</table>
	</div>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="20" {if $numPerPage==20}selected="selected"{/if}>20</option>
				<option value="50" {if $numPerPage==50}selected="selected"{/if}>50</option>
				<option value="66" {if $numPerPage==66}selected="selected"{/if}>66</option>
				<option value="100" {if $numPerPage==100}selected="selected"{/if}>100</option>
				<option value="200" {if $numPerPage==200}selected="selected"{/if}>200</option>
			</select>
			<span>条，共{$totalCount}条</span>
		</div>
		
		<div class="pagination" targetType="navTab" totalCount="{$totalCount}" numPerPage="{$numPerPage}" pageNumShown="10" currentPage="{$pageNum}"></div>
	</div>
</div>
